home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / spawnsb.com / SPAWN.TXT < prev    next >
Encoding:
Text File  |  1991-05-27  |  3.2 KB  |  92 lines

  1.             Overlay Spawn Function
  2.  
  3.  
  4.     description:
  5.     
  6.     This diskette contains the following library: SPAWNS.
  7.     This is for use with programs written using the small memory model.
  8.     This library contains the following function: spawn, spawnp and
  9.     spawne.
  10.  
  11.     Spawn.
  12.  
  13.     This function takes as parameters a program name and any parameters that
  14.     are to be passed to this program. Before executing the new program spawn 
  15.     will swap to either EMS, and or, Disk the current program leaving only a
  16.     small kernel in memory. On termination of the spawned program to function
  17.     will restore the parent from EMS, and or Disk.
  18.  
  19.     Usage:
  20.  
  21.     spawn("d:\file_path\file_name","arg1","arg2",NULL);
  22.  
  23.       arg1, arg2 are pointers to NULL terminated strings.    
  24.  
  25.      You must supply the full file name i.e "CL.EXE" not "CL".
  26.      The arguement list must be terminated by a NULL.
  27.      the length of all the arguements must not exceed 128 bytes.
  28.  
  29.     upon invocation spawn will verify that the parameters do not exceed
  30.     128 bytes. It will then save all memory belonging to the current program
  31.     in either EMS or Disk. It will save as much to EMS as it can and will
  32.     then start saving to Disk. After saving everything it shrinks the current
  33.     programs memory usage to about 800 Bytes and invokes the program passed.
  34.     Upon return spawn restores memory from either EMS or Disk. Frees the EMS
  35.     pages and deletes the swap file. Control is then returned back to the
  36.     calling program.
  37.  
  38.     These functions can be called from 'C' programs only.
  39.  
  40.     Include stdio.h and stdlib.h in your C code.
  41.     Do not pass pointers to the parents data as arguements to the child
  42.     program.         
  43.  
  44.     spawnp.
  45.  
  46.     This function will look in the current directory for the program to
  47.     execute. If it does not find it there it will the PATH= environment
  48.     variable. If it finds the program it will invoke spawn.
  49.  
  50.       usage is spawnp("CL.EXE","arg1","arg2",NULL);
  51.  
  52.       arg1, arg2 are pointers to NULL terminated strings.    
  53.     
  54.     spawne.
  55.     
  56.     Usage is spawne("C:\\MYPROG.EXE\\","arg1","arg2",NULL,env);
  57.  
  58.     You must supply the full path and name of the executeable.
  59.     arg1,arg2 are pointers to NULL terminated strings.
  60.         env is of the following form:
  61.  
  62.     char *env[ ] = {"PROMPT=$P$G",
  63.                         "COMSPEC=C:\\COMMAND.COM",
  64.                         NULL };  
  65.      
  66.     This function will invoke the child program setting its environment    to
  67.     the passed strings. It will then invoke spawn to swap the parent program
  68.     to disk and execute the child
  69.      All these functions return either the child programs return code or -1
  70.      on error. On an error the global external ERRNO will be set to the
  71.      following values.
  72.  
  73.      2 - Program not found
  74.      3 - Path not found
  75.      5 - Access denied
  76.      8 - Not enough memory
  77.  
  78.      
  79.     For a $15 registration fee you will receive the Large,Medium and compact
  80.     Model librarys. Please include $2 for postage etc.
  81.  
  82.     
  83.     send your check to Steve Bridges
  84.                1391 union street
  85.                Manchester NH 03104.
  86.  
  87.  
  88.     As usual you use this function as is at your own risk.
  89.  
  90.    
  91.      
  92.